<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //原数组不变

        // 数组的join()方法：数组=>字符串
        // 字符串的split()方法：字符串=>数组
        //join()的参数表示数组转为字符串的时候用什么分割开，留空默认为逗号,如同调用ToString()方法
        //splice()d的参数表示以什么字符拆分字符串，一般不留空

        console.log([22,33,44,55].join())//"22,33,44,55"
        console.log([22,33,44,55].toString())//"22,33,44,55"
        console.log([22,33,44,55].join('-'))//"22-33-44-55"
        console.log([22,33,44,55].join('★'))//"22★33★44★55"

        console.log('abcdef'.split())//['abcdef']
        console.log('abcdef'.split(''))//['a','b','c','d','e','f']
        console.log('a-b-c-d-e-f'.split(''))//['a','-',b','-',c','-',d','-',e','-',f']
        console.log('a-b-c-d-e-f'.split('-'))//['a','b','c','d','e','f']

        //字符串也可以用下标直接调用
        console.log('我爱慕课网'[0])//"我"
        console.log('我爱慕课网'.charAt(0))

        //也可以直接用[]直接便利字符串


    </script>
</body>
</html>